import {
    http
} from '@/utils/request'
import store from '@/store'

export const userSetlanguage = async (data) => {
    let res = await http.post({
        url: '/user/setlanguage',
        data
    })
    return res
}

export const upsetSex = async (data) => {
    let res = await http.post({
        url: '/useronline/upset',
        data
    })
    return res
}

export const fetchCourse = async (data) => {
    let res = await http.post({
        url: '/useronline/getcourse',
        data
    })
    return res
}
export const fetchdoubleCourse = async (data) => {
    let res = await http.post({
        url: '/useronline/getdoublecourse',
        data
    })
    return res
}

export const fastLogin = async (data) => {
    let res = await http.post({
      url: '/useronline/fastlogin',
      data
    })
    if (res.code === 1) {
      store.commit('setLogin', res.data)
    }
    return res
  }
  
  export const userLogin = async (data) => {
    let res = await http.post({
      url: '/useronline/login',
      data
    })
    if (res.code === 1) {
      store.commit('setLogin', res.data)
    }
    return res
  }

  export const sendSms = async (data) => {
    let res = await http.post({
      url: '/sms/sendmsg',
      data
    })
    return res
  }
  
  export const checkSms = async (data) => {
    let res = await http.post({
      url: '/sms/check',
      data
    })
    return res
  }

  export const resetPasswd = async (data) => {
    let res = await http.post({
      url: '/user/password',
      data
    })
    return res
  }
  
  export const teacherResetPasswd = async (data) => {
    let res = await http.post({
      url: '/useronline/password',
      data
    })
    return res
  }
  export const startTime = async (data) => {
    let res = await http.post({
      url: '/index/starttime',
      data
    })
    return res
  }
  export const stopTime = async (data) => {
    let res = await http.post({
      url: '/index/stoptime',
      data
    })
    return res
  }